﻿namespace HRM.CORE
{

    using APP.HELPER.Data.Helper;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;

    public class HRM_INSURANCE
    {
        private string m_Description;
        private string m_EmployeeCode;
        private string m_EmployeeName;
        private DateTime m_FromDate;
        private string m_HealthInsuranceCode;
        private string m_Hospital;
        private string m_IDCard;
        private Guid m_InsuranceID;
        private Guid m_InsuranceTableListID;
        private bool m_IsPay;
        private string m_MainAddress;
        private decimal m_NewAllowance1;
        private decimal m_NewAllowance2;
        private decimal m_NewAllowance3;
        private decimal m_NewAllowance4;
        private decimal m_NewSalary;
        private decimal m_OldAllowance1;
        private decimal m_OldAllowance2;
        private decimal m_OldAllowance3;
        private decimal m_OldAllowance4;
        private decimal m_OldSalary;
        private string m_Province;
        private double m_Rate;
        private bool m_Sex;
        private string m_SocialInsuranceCode;
        private DateTime m_ToDate;
        private int m_Type;

        public HRM_INSURANCE()
        {
            this.m_InsuranceID = Guid.Empty;
            this.m_InsuranceTableListID = Guid.Empty;
            this.m_EmployeeCode = "";
            this.m_EmployeeName = "";
            this.m_SocialInsuranceCode = "";
            this.m_HealthInsuranceCode = "";
            this.m_Sex = true;
            this.m_IDCard = "";
            this.m_MainAddress = "";
            this.m_Province = "";
            this.m_Hospital = "";
            this.m_OldSalary = 0M;
            this.m_OldAllowance1 = 0M;
            this.m_OldAllowance2 = 0M;
            this.m_OldAllowance3 = 0M;
            this.m_OldAllowance4 = 0M;
            this.m_NewSalary = 0M;
            this.m_NewAllowance1 = 0M;
            this.m_NewAllowance2 = 0M;
            this.m_NewAllowance3 = 0M;
            this.m_NewAllowance4 = 0M;
            this.m_FromDate = DateTime.Now;
            this.m_ToDate = DateTime.Now;
            this.m_Rate = 0.0;
            this.m_IsPay = true;
            this.m_Type = 0;
            this.m_Description = "";
        }

        public HRM_INSURANCE(Guid InsuranceID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, bool Sex, string IDCard, string MainAddress, string Province, string Hospital, decimal OldSalary, decimal OldAllowance1, decimal OldAllowance2, decimal OldAllowance3, decimal OldAllowance4, decimal NewSalary, decimal NewAllowance1, decimal NewAllowance2, decimal NewAllowance3, decimal NewAllowance4, DateTime FromDate, DateTime ToDate, double Rate, bool IsPay, int Type, string Description)
        {
            this.m_InsuranceID = InsuranceID;
            this.m_InsuranceTableListID = InsuranceTableListID;
            this.m_EmployeeCode = EmployeeCode;
            this.m_EmployeeName = EmployeeName;
            this.m_SocialInsuranceCode = SocialInsuranceCode;
            this.m_HealthInsuranceCode = HealthInsuranceCode;
            this.m_Sex = Sex;
            this.m_IDCard = IDCard;
            this.m_MainAddress = MainAddress;
            this.m_Province = Province;
            this.m_Hospital = Hospital;
            this.m_OldSalary = OldSalary;
            this.m_OldAllowance1 = OldAllowance1;
            this.m_OldAllowance2 = OldAllowance2;
            this.m_OldAllowance3 = OldAllowance3;
            this.m_OldAllowance4 = OldAllowance4;
            this.m_NewSalary = NewSalary;
            this.m_NewAllowance1 = NewAllowance1;
            this.m_NewAllowance2 = NewAllowance2;
            this.m_NewAllowance3 = NewAllowance3;
            this.m_NewAllowance4 = NewAllowance4;
            this.m_FromDate = FromDate;
            this.m_ToDate = ToDate;
            this.m_Rate = Rate;
            this.m_IsPay = IsPay;
            this.m_Type = Type;
            this.m_Description = Description;
        }

        public string Delete()
        {
            string[] myParams = new string[] { "@InsuranceID" };
            object[] myValues = new object[] { this.m_InsuranceID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_Delete", myParams, myValues);
        }

        public string Delete(Guid InsuranceID)
        {
            string[] myParams = new string[] { "@InsuranceID" };
            object[] myValues = new object[] { InsuranceID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_Delete", myParams, myValues);
        }

        public string Delete(SqlConnection myConnection, Guid InsuranceID)
        {
            string[] myParams = new string[] { "@InsuranceID" };
            object[] myValues = new object[] { InsuranceID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_INSURANCE_Delete", myParams, myValues);
        }

        public string Delete(SqlTransaction myTransaction, Guid InsuranceID)
        {
            string[] myParams = new string[] { "@InsuranceID" };
            object[] myValues = new object[] { InsuranceID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_INSURANCE_Delete", myParams, myValues);
        }

        public bool Exist(Guid InsuranceID)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@InsuranceID" };
            object[] myValues = new object[] { InsuranceID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_INSURANCE_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                helper.Close();
                reader = null;
            }
            return hasRows;
        }

        public string Get(Guid InsuranceID)
        {
            string str = "";
            string[] myParams = new string[] { "@InsuranceID" };
            object[] myValues = new object[] { InsuranceID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_INSURANCE_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_InsuranceID = reader.GetGuid(reader.GetOrdinal("InsuranceID"));
                    this.m_InsuranceTableListID = reader.GetGuid(reader.GetOrdinal("InsuranceTableListID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_EmployeeName = Convert.ToString(reader["EmployeeName"]);
                    this.m_SocialInsuranceCode = Convert.ToString(reader["SocialInsuranceCode"]);
                    this.m_HealthInsuranceCode = Convert.ToString(reader["HealthInsuranceCode"]);
                    this.m_Sex = Convert.ToBoolean(reader["Sex"]);
                    this.m_IDCard = Convert.ToString(reader["IDCard"]);
                    this.m_MainAddress = Convert.ToString(reader["MainAddress"]);
                    this.m_Province = Convert.ToString(reader["Province"]);
                    this.m_Hospital = Convert.ToString(reader["Hospital"]);
                    this.m_OldSalary = Convert.ToDecimal(reader["OldSalary"]);
                    this.m_OldAllowance1 = Convert.ToDecimal(reader["OldAllowance1"]);
                    this.m_OldAllowance2 = Convert.ToDecimal(reader["OldAllowance2"]);
                    this.m_OldAllowance3 = Convert.ToDecimal(reader["OldAllowance3"]);
                    this.m_OldAllowance4 = Convert.ToDecimal(reader["OldAllowance4"]);
                    this.m_NewSalary = Convert.ToDecimal(reader["NewSalary"]);
                    this.m_NewAllowance1 = Convert.ToDecimal(reader["NewAllowance1"]);
                    this.m_NewAllowance2 = Convert.ToDecimal(reader["NewAllowance2"]);
                    this.m_NewAllowance3 = Convert.ToDecimal(reader["NewAllowance3"]);
                    this.m_NewAllowance4 = Convert.ToDecimal(reader["NewAllowance4"]);
                    this.m_FromDate = Convert.ToDateTime(reader["FromDate"]);
                    this.m_ToDate = Convert.ToDateTime(reader["ToDate"]);
                    this.m_Rate = Convert.ToDouble(reader["Rate"]);
                    this.m_IsPay = Convert.ToBoolean(reader["IsPay"]);
                    this.m_Type = Convert.ToInt32(reader["Type"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlConnection myConnection, Guid InsuranceID)
        {
            string str = "";
            string[] myParams = new string[] { "@InsuranceID" };
            object[] myValues = new object[] { InsuranceID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myConnection, "HRM_INSURANCE_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_InsuranceID = reader.GetGuid(reader.GetOrdinal("InsuranceID"));
                    this.m_InsuranceTableListID = reader.GetGuid(reader.GetOrdinal("InsuranceTableListID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_EmployeeName = Convert.ToString(reader["EmployeeName"]);
                    this.m_SocialInsuranceCode = Convert.ToString(reader["SocialInsuranceCode"]);
                    this.m_HealthInsuranceCode = Convert.ToString(reader["HealthInsuranceCode"]);
                    this.m_Sex = Convert.ToBoolean(reader["Sex"]);
                    this.m_IDCard = Convert.ToString(reader["IDCard"]);
                    this.m_MainAddress = Convert.ToString(reader["MainAddress"]);
                    this.m_Province = Convert.ToString(reader["Province"]);
                    this.m_Hospital = Convert.ToString(reader["Hospital"]);
                    this.m_OldSalary = Convert.ToDecimal(reader["OldSalary"]);
                    this.m_OldAllowance1 = Convert.ToDecimal(reader["OldAllowance1"]);
                    this.m_OldAllowance2 = Convert.ToDecimal(reader["OldAllowance2"]);
                    this.m_OldAllowance3 = Convert.ToDecimal(reader["OldAllowance3"]);
                    this.m_OldAllowance4 = Convert.ToDecimal(reader["OldAllowance4"]);
                    this.m_NewSalary = Convert.ToDecimal(reader["NewSalary"]);
                    this.m_NewAllowance1 = Convert.ToDecimal(reader["NewAllowance1"]);
                    this.m_NewAllowance2 = Convert.ToDecimal(reader["NewAllowance2"]);
                    this.m_NewAllowance3 = Convert.ToDecimal(reader["NewAllowance3"]);
                    this.m_NewAllowance4 = Convert.ToDecimal(reader["NewAllowance4"]);
                    this.m_FromDate = Convert.ToDateTime(reader["FromDate"]);
                    this.m_ToDate = Convert.ToDateTime(reader["ToDate"]);
                    this.m_Rate = Convert.ToDouble(reader["Rate"]);
                    this.m_IsPay = Convert.ToBoolean(reader["IsPay"]);
                    this.m_Type = Convert.ToInt32(reader["Type"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlTransaction myTransaction, Guid InsuranceID)
        {
            string str = "";
            string[] myParams = new string[] { "@InsuranceID" };
            object[] myValues = new object[] { InsuranceID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myTransaction, "HRM_INSURANCE_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_InsuranceID = reader.GetGuid(reader.GetOrdinal("InsuranceID"));
                    this.m_InsuranceTableListID = reader.GetGuid(reader.GetOrdinal("InsuranceTableListID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_EmployeeName = Convert.ToString(reader["EmployeeName"]);
                    this.m_SocialInsuranceCode = Convert.ToString(reader["SocialInsuranceCode"]);
                    this.m_HealthInsuranceCode = Convert.ToString(reader["HealthInsuranceCode"]);
                    this.m_Sex = Convert.ToBoolean(reader["Sex"]);
                    this.m_IDCard = Convert.ToString(reader["IDCard"]);
                    this.m_MainAddress = Convert.ToString(reader["MainAddress"]);
                    this.m_Province = Convert.ToString(reader["Province"]);
                    this.m_Hospital = Convert.ToString(reader["Hospital"]);
                    this.m_OldSalary = Convert.ToDecimal(reader["OldSalary"]);
                    this.m_OldAllowance1 = Convert.ToDecimal(reader["OldAllowance1"]);
                    this.m_OldAllowance2 = Convert.ToDecimal(reader["OldAllowance2"]);
                    this.m_OldAllowance3 = Convert.ToDecimal(reader["OldAllowance3"]);
                    this.m_OldAllowance4 = Convert.ToDecimal(reader["OldAllowance4"]);
                    this.m_NewSalary = Convert.ToDecimal(reader["NewSalary"]);
                    this.m_NewAllowance1 = Convert.ToDecimal(reader["NewAllowance1"]);
                    this.m_NewAllowance2 = Convert.ToDecimal(reader["NewAllowance2"]);
                    this.m_NewAllowance3 = Convert.ToDecimal(reader["NewAllowance3"]);
                    this.m_NewAllowance4 = Convert.ToDecimal(reader["NewAllowance4"]);
                    this.m_FromDate = Convert.ToDateTime(reader["FromDate"]);
                    this.m_ToDate = Convert.ToDateTime(reader["ToDate"]);
                    this.m_Rate = Convert.ToDouble(reader["Rate"]);
                    this.m_IsPay = Convert.ToBoolean(reader["IsPay"]);
                    this.m_Type = Convert.ToInt32(reader["Type"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public DataTable Get02aTBHTotalUp(Guid InsuranceTableListID)
        {
            string[] myParams = new string[] { "@InsuranceTableListID" };
            object[] myValues = new object[] { InsuranceTableListID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_Get02aTBHTotalUp", myParams, myValues);
        }

        public DataTable Get03aTBHTotalUp(Guid InsuranceTableListID)
        {
            string[] myParams = new string[] { "@InsuranceTableListID" };
            object[] myValues = new object[] { InsuranceTableListID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_Get03aTBHTotalUp", myParams, myValues);
        }

        public DataTable GetA01TS(string EmployeeCode)
        {
            string[] myParams = new string[] { "@EmployeeCode" };
            object[] myValues = new object[] { EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetA01TS", myParams, myValues);
        }

        public DataTable GetList()
        {
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetList");
        }

        public DataTable GetList(Guid InsuranceTableListID)
        {
            string[] myParams = new string[] { "@InsuranceTableListID" };
            object[] myValues = new object[] { InsuranceTableListID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetListByInsuranceTableList", myParams, myValues);
        }

        public DataTable GetList03aTBH(Guid InsuranceTableListID)
        {
            string[] myParams = new string[] { "@InsuranceTableListID" };
            object[] myValues = new object[] { InsuranceTableListID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetList03aTBH", myParams, myValues);
        }

        public DataTable GetListAddHealth(Guid InsuranceTableListID)
        {
            string[] myParams = new string[] { "@InsuranceTableListID" };
            object[] myValues = new object[] { InsuranceTableListID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetListAddHealth", myParams, myValues);
        }

        public DataTable GetListAddUnemployment(Guid InsuranceTableListID)
        {
            string[] myParams = new string[] { "@InsuranceTableListID" };
            object[] myValues = new object[] { InsuranceTableListID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetListAddUnemployment", myParams, myValues);
        }

        public DataTable GetListByType(Guid InsuranceTableListID, int Type)
        {
            string[] myParams = new string[] { "@InsuranceTableListID", "@Type" };
            object[] myValues = new object[] { InsuranceTableListID, Type };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetListByType", myParams, myValues);
        }

        public DataTable GetListChangeSalary(Guid InsuranceTableListID)
        {
            string[] myParams = new string[] { "@InsuranceTableListID" };
            object[] myValues = new object[] { InsuranceTableListID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetListChangeSalary", myParams, myValues);
        }

        public DataTable GetListDecrease(Guid InsuranceTableListID)
        {
            string[] myParams = new string[] { "@InsuranceTableListID" };
            object[] myValues = new object[] { InsuranceTableListID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetListDecrease", myParams, myValues);
        }

        public DataTable GetListEmployee(int Level, string Code, int Status)
        {
            string[] myParams = new string[] { "@Level", "@Code", "@Status" };
            object[] myValues = new object[] { Level, Code, Status };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetListEmployee", myParams, myValues);
        }

        public DataTable GetListEmployeeSearch(string Key, int Status)
        {
            string[] myParams = new string[] { "@Key", "@Status" };
            object[] myValues = new object[] { Key, Status };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetListEmployeeSearch", myParams, myValues);
        }

        public DataTable GetListIncrease(Guid InsuranceTableListID)
        {
            string[] myParams = new string[] { "@InsuranceTableListID" };
            object[] myValues = new object[] { InsuranceTableListID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetListIncrease", myParams, myValues);
        }

        public DataTable GetListType(Guid InsuranceTableListID)
        {
            string[] myParams = new string[] { "@InsuranceTableListID" };
            object[] myValues = new object[] { InsuranceTableListID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_GetListType", myParams, myValues);
        }

        public int GetStatus(string EmployeeCode)
        {
            int num = 0;
            string[] myParams = new string[] { "@EmployeeCode" };
            object[] myValues = new object[] { EmployeeCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_INSURANCE_GetStatus", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    num = Convert.ToInt32(reader["Status"]);
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return num;
        }

        public string Insert()
        {
            string[] myParams = new string[] { 
                "@InsuranceID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@Sex", "@IDCard", "@MainAddress", "@Province", "@Hospital", "@OldSalary", "@OldAllowance1", "@OldAllowance2", "@OldAllowance3", "@OldAllowance4", 
                "@NewSalary", "@NewAllowance1", "@NewAllowance2", "@NewAllowance3", "@NewAllowance4", "@FromDate", "@ToDate", "@Rate", "@IsPay", "@Type", "@Description"
             };
            object[] myValues = new object[] { 
                this.m_InsuranceID, this.m_InsuranceTableListID, this.m_EmployeeCode, this.m_EmployeeName, this.m_SocialInsuranceCode, this.m_HealthInsuranceCode, this.m_Sex, this.m_IDCard, this.m_MainAddress, this.m_Province, this.m_Hospital, this.m_OldSalary, this.m_OldAllowance1, this.m_OldAllowance2, this.m_OldAllowance3, this.m_OldAllowance4, 
                this.m_NewSalary, this.m_NewAllowance1, this.m_NewAllowance2, this.m_NewAllowance3, this.m_NewAllowance4, this.m_FromDate, this.m_ToDate, this.m_Rate, this.m_IsPay, this.m_Type, this.m_Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction)
        {
            string[] myParams = new string[] { 
                "@InsuranceID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@Sex", "@IDCard", "@MainAddress", "@Province", "@Hospital", "@OldSalary", "@OldAllowance1", "@OldAllowance2", "@OldAllowance3", "@OldAllowance4", 
                "@NewSalary", "@NewAllowance1", "@NewAllowance2", "@NewAllowance3", "@NewAllowance4", "@FromDate", "@ToDate", "@Rate", "@IsPay", "@Type", "@Description"
             };
            object[] myValues = new object[] { 
                this.m_InsuranceID, this.m_InsuranceTableListID, this.m_EmployeeCode, this.m_EmployeeName, this.m_SocialInsuranceCode, this.m_HealthInsuranceCode, this.m_Sex, this.m_IDCard, this.m_MainAddress, this.m_Province, this.m_Hospital, this.m_OldSalary, this.m_OldAllowance1, this.m_OldAllowance2, this.m_OldAllowance3, this.m_OldAllowance4, 
                this.m_NewSalary, this.m_NewAllowance1, this.m_NewAllowance2, this.m_NewAllowance3, this.m_NewAllowance4, this.m_FromDate, this.m_ToDate, this.m_Rate, this.m_IsPay, this.m_Type, this.m_Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_INSURANCE_Insert", myParams, myValues);
        }

        public string Insert(Guid InsuranceID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, bool Sex, string IDCard, string MainAddress, string Province, string Hospital, decimal OldSalary, decimal OldAllowance1, decimal OldAllowance2, decimal OldAllowance3, decimal OldAllowance4, decimal NewSalary, decimal NewAllowance1, decimal NewAllowance2, decimal NewAllowance3, decimal NewAllowance4, DateTime FromDate, DateTime ToDate, double Rate, bool IsPay, int Type, string Description)
        {
            string[] myParams = new string[] { 
                "@InsuranceID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@Sex", "@IDCard", "@MainAddress", "@Province", "@Hospital", "@OldSalary", "@OldAllowance1", "@OldAllowance2", "@OldAllowance3", "@OldAllowance4", 
                "@NewSalary", "@NewAllowance1", "@NewAllowance2", "@NewAllowance3", "@NewAllowance4", "@FromDate", "@ToDate", "@Rate", "@IsPay", "@Type", "@Description"
             };
            object[] myValues = new object[] { 
                InsuranceID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, Sex, IDCard, MainAddress, Province, Hospital, OldSalary, OldAllowance1, OldAllowance2, OldAllowance3, OldAllowance4, 
                NewSalary, NewAllowance1, NewAllowance2, NewAllowance3, NewAllowance4, FromDate, ToDate, Rate, IsPay, Type, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_Insert", myParams, myValues);
        }

        public string Insert(SqlConnection myConnection, Guid InsuranceID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, bool Sex, string IDCard, string MainAddress, string Province, string Hospital, decimal OldSalary, decimal OldAllowance1, decimal OldAllowance2, decimal OldAllowance3, decimal OldAllowance4, decimal NewSalary, decimal NewAllowance1, decimal NewAllowance2, decimal NewAllowance3, decimal NewAllowance4, DateTime FromDate, DateTime ToDate, double Rate, bool IsPay, int Type, string Description)
        {
            string[] myParams = new string[] { 
                "@InsuranceID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@Sex", "@IDCard", "@MainAddress", "@Province", "@Hospital", "@OldSalary", "@OldAllowance1", "@OldAllowance2", "@OldAllowance3", "@OldAllowance4", 
                "@NewSalary", "@NewAllowance1", "@NewAllowance2", "@NewAllowance3", "@NewAllowance4", "@FromDate", "@ToDate", "@Rate", "@IsPay", "@Type", "@Description"
             };
            object[] myValues = new object[] { 
                InsuranceID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, Sex, IDCard, MainAddress, Province, Hospital, OldSalary, OldAllowance1, OldAllowance2, OldAllowance3, OldAllowance4, 
                NewSalary, NewAllowance1, NewAllowance2, NewAllowance3, NewAllowance4, FromDate, ToDate, Rate, IsPay, Type, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_INSURANCE_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction, Guid InsuranceID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, bool Sex, string IDCard, string MainAddress, string Province, string Hospital, decimal OldSalary, decimal OldAllowance1, decimal OldAllowance2, decimal OldAllowance3, decimal OldAllowance4, decimal NewSalary, decimal NewAllowance1, decimal NewAllowance2, decimal NewAllowance3, decimal NewAllowance4, DateTime FromDate, DateTime ToDate, double Rate, bool IsPay, int Type, string Description)
        {
            string[] myParams = new string[] { 
                "@InsuranceID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@Sex", "@IDCard", "@MainAddress", "@Province", "@Hospital", "@OldSalary", "@OldAllowance1", "@OldAllowance2", "@OldAllowance3", "@OldAllowance4", 
                "@NewSalary", "@NewAllowance1", "@NewAllowance2", "@NewAllowance3", "@NewAllowance4", "@FromDate", "@ToDate", "@Rate", "@IsPay", "@Type", "@Description"
             };
            object[] myValues = new object[] { 
                InsuranceID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, Sex, IDCard, MainAddress, Province, Hospital, OldSalary, OldAllowance1, OldAllowance2, OldAllowance3, OldAllowance4, 
                NewSalary, NewAllowance1, NewAllowance2, NewAllowance3, NewAllowance4, FromDate, ToDate, Rate, IsPay, Type, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_INSURANCE_Insert", myParams, myValues);
        }

        public string NewID()
        {
            return SqlHelper.GenCode("HRM_INSURANCE", "InsuranceID", "CV");
        }

        public string Update()
        {
            string[] myParams = new string[] { 
                "@InsuranceID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@Sex", "@IDCard", "@MainAddress", "@Province", "@Hospital", "@OldSalary", "@OldAllowance1", "@OldAllowance2", "@OldAllowance3", "@OldAllowance4", 
                "@NewSalary", "@NewAllowance1", "@NewAllowance2", "@NewAllowance3", "@NewAllowance4", "@FromDate", "@ToDate", "@Rate", "@IsPay", "@Type", "@Description"
             };
            object[] myValues = new object[] { 
                this.m_InsuranceID, this.m_InsuranceTableListID, this.m_EmployeeCode, this.m_EmployeeName, this.m_SocialInsuranceCode, this.m_HealthInsuranceCode, this.m_Sex, this.m_IDCard, this.m_MainAddress, this.m_Province, this.m_Hospital, this.m_OldSalary, this.m_OldAllowance1, this.m_OldAllowance2, this.m_OldAllowance3, this.m_OldAllowance4, 
                this.m_NewSalary, this.m_NewAllowance1, this.m_NewAllowance2, this.m_NewAllowance3, this.m_NewAllowance4, this.m_FromDate, this.m_ToDate, this.m_Rate, this.m_IsPay, this.m_Type, this.m_Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_Update", myParams, myValues);
        }

        public string Update(Guid InsuranceID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, bool Sex, string IDCard, string MainAddress, string Province, string Hospital, decimal OldSalary, decimal OldAllowance1, decimal OldAllowance2, decimal OldAllowance3, decimal OldAllowance4, decimal NewSalary, decimal NewAllowance1, decimal NewAllowance2, decimal NewAllowance3, decimal NewAllowance4, DateTime FromDate, DateTime ToDate, double Rate, bool IsPay, int Type, string Description)
        {
            string[] myParams = new string[] { 
                "@InsuranceID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@Sex", "@IDCard", "@MainAddress", "@Province", "@Hospital", "@OldSalary", "@OldAllowance1", "@OldAllowance2", "@OldAllowance3", "@OldAllowance4", 
                "@NewSalary", "@NewAllowance1", "@NewAllowance2", "@NewAllowance3", "@NewAllowance4", "@FromDate", "@ToDate", "@Rate", "@IsPay", "@Type", "@Description"
             };
            object[] myValues = new object[] { 
                InsuranceID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, Sex, IDCard, MainAddress, Province, Hospital, OldSalary, OldAllowance1, OldAllowance2, OldAllowance3, OldAllowance4, 
                NewSalary, NewAllowance1, NewAllowance2, NewAllowance3, NewAllowance4, FromDate, ToDate, Rate, IsPay, Type, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_Update", myParams, myValues);
        }

        public string Update(SqlConnection myConnection, Guid InsuranceID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, bool Sex, string IDCard, string MainAddress, string Province, string Hospital, decimal OldSalary, decimal OldAllowance1, decimal OldAllowance2, decimal OldAllowance3, decimal OldAllowance4, decimal NewSalary, decimal NewAllowance1, decimal NewAllowance2, decimal NewAllowance3, decimal NewAllowance4, DateTime FromDate, DateTime ToDate, double Rate, bool IsPay, int Type, string Description)
        {
            string[] myParams = new string[] { 
                "@InsuranceID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@Sex", "@IDCard", "@MainAddress", "@Province", "@Hospital", "@OldSalary", "@OldAllowance1", "@OldAllowance2", "@OldAllowance3", "@OldAllowance4", 
                "@NewSalary", "@NewAllowance1", "@NewAllowance2", "@NewAllowance3", "@NewAllowance4", "@FromDate", "@ToDate", "@Rate", "@IsPay", "@Type", "@Description"
             };
            object[] myValues = new object[] { 
                InsuranceID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, Sex, IDCard, MainAddress, Province, Hospital, OldSalary, OldAllowance1, OldAllowance2, OldAllowance3, OldAllowance4, 
                NewSalary, NewAllowance1, NewAllowance2, NewAllowance3, NewAllowance4, FromDate, ToDate, Rate, IsPay, Type, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_INSURANCE_Update", myParams, myValues);
        }

        public string Update(SqlTransaction myTransaction, Guid InsuranceID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, bool Sex, string IDCard, string MainAddress, string Province, string Hospital, decimal OldSalary, decimal OldAllowance1, decimal OldAllowance2, decimal OldAllowance3, decimal OldAllowance4, decimal NewSalary, decimal NewAllowance1, decimal NewAllowance2, decimal NewAllowance3, decimal NewAllowance4, DateTime FromDate, DateTime ToDate, double Rate, bool IsPay, int Type, string Description)
        {
            string[] myParams = new string[] { 
                "@InsuranceID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@Sex", "@IDCard", "@MainAddress", "@Province", "@Hospital", "@OldSalary", "@OldAllowance1", "@OldAllowance2", "@OldAllowance3", "@OldAllowance4", 
                "@NewSalary", "@NewAllowance1", "@NewAllowance2", "@NewAllowance3", "@NewAllowance4", "@FromDate", "@ToDate", "@Rate", "@IsPay", "@Type", "@Description"
             };
            object[] myValues = new object[] { 
                InsuranceID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, Sex, IDCard, MainAddress, Province, Hospital, OldSalary, OldAllowance1, OldAllowance2, OldAllowance3, OldAllowance4, 
                NewSalary, NewAllowance1, NewAllowance2, NewAllowance3, NewAllowance4, FromDate, ToDate, Rate, IsPay, Type, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_INSURANCE_Update", myParams, myValues);
        }

        [DisplayName("Description"), Category("Column")]
        public string Description
        {
            get
            {
                return this.m_Description;
            }
            set
            {
                this.m_Description = value;
            }
        }

        [Category("Column"), DisplayName("EmployeeCode")]
        public string EmployeeCode
        {
            get
            {
                return this.m_EmployeeCode;
            }
            set
            {
                this.m_EmployeeCode = value;
            }
        }

        [DisplayName("EmployeeName"), Category("Column")]
        public string EmployeeName
        {
            get
            {
                return this.m_EmployeeName;
            }
            set
            {
                this.m_EmployeeName = value;
            }
        }

        [DisplayName("FromDate"), Category("Column")]
        public DateTime FromDate
        {
            get
            {
                return this.m_FromDate;
            }
            set
            {
                this.m_FromDate = value;
            }
        }

        [Category("Column"), DisplayName("HealthInsuranceCode")]
        public string HealthInsuranceCode
        {
            get
            {
                return this.m_HealthInsuranceCode;
            }
            set
            {
                this.m_HealthInsuranceCode = value;
            }
        }

        [Category("Column"), DisplayName("Hospital")]
        public string Hospital
        {
            get
            {
                return this.m_Hospital;
            }
            set
            {
                this.m_Hospital = value;
            }
        }

        [Category("Column"), DisplayName("IDCard")]
        public string IDCard
        {
            get
            {
                return this.m_IDCard;
            }
            set
            {
                this.m_IDCard = value;
            }
        }

        [Category("Primary Key"), DisplayName("InsuranceID")]
        public Guid InsuranceID
        {
            get
            {
                return this.m_InsuranceID;
            }
            set
            {
                this.m_InsuranceID = value;
            }
        }

        [Category("Column"), DisplayName("InsuranceTableListID")]
        public Guid InsuranceTableListID
        {
            get
            {
                return this.m_InsuranceTableListID;
            }
            set
            {
                this.m_InsuranceTableListID = value;
            }
        }

        [DisplayName("IsPay"), Category("Column")]
        public bool IsPay
        {
            get
            {
                return this.m_IsPay;
            }
            set
            {
                this.m_IsPay = value;
            }
        }

        [DisplayName("MainAddress"), Category("Column")]
        public string MainAddress
        {
            get
            {
                return this.m_MainAddress;
            }
            set
            {
                this.m_MainAddress = value;
            }
        }

        [Category("Column"), DisplayName("NewAllowance1")]
        public decimal NewAllowance1
        {
            get
            {
                return this.m_NewAllowance1;
            }
            set
            {
                this.m_NewAllowance1 = value;
            }
        }

        [DisplayName("NewAllowance2"), Category("Column")]
        public decimal NewAllowance2
        {
            get
            {
                return this.m_NewAllowance2;
            }
            set
            {
                this.m_NewAllowance2 = value;
            }
        }

        [Category("Column"), DisplayName("NewAllowance3")]
        public decimal NewAllowance3
        {
            get
            {
                return this.m_NewAllowance3;
            }
            set
            {
                this.m_NewAllowance3 = value;
            }
        }

        [Category("Column"), DisplayName("NewAllowance4")]
        public decimal NewAllowance4
        {
            get
            {
                return this.m_NewAllowance4;
            }
            set
            {
                this.m_NewAllowance4 = value;
            }
        }

        [DisplayName("NewSalary"), Category("Column")]
        public decimal NewSalary
        {
            get
            {
                return this.m_NewSalary;
            }
            set
            {
                this.m_NewSalary = value;
            }
        }

        [DisplayName("OldAllowance1"), Category("Column")]
        public decimal OldAllowance1
        {
            get
            {
                return this.m_OldAllowance1;
            }
            set
            {
                this.m_OldAllowance1 = value;
            }
        }

        [Category("Column"), DisplayName("OldAllowance2")]
        public decimal OldAllowance2
        {
            get
            {
                return this.m_OldAllowance2;
            }
            set
            {
                this.m_OldAllowance2 = value;
            }
        }

        [DisplayName("OldAllowance3"), Category("Column")]
        public decimal OldAllowance3
        {
            get
            {
                return this.m_OldAllowance3;
            }
            set
            {
                this.m_OldAllowance3 = value;
            }
        }

        [Category("Column"), DisplayName("OldAllowance4")]
        public decimal OldAllowance4
        {
            get
            {
                return this.m_OldAllowance4;
            }
            set
            {
                this.m_OldAllowance4 = value;
            }
        }

        [DisplayName("OldSalary"), Category("Column")]
        public decimal OldSalary
        {
            get
            {
                return this.m_OldSalary;
            }
            set
            {
                this.m_OldSalary = value;
            }
        }

        public string ProductName
        {
            get
            {
                return "Class HRM_INSURANCE";
            }
        }

        public string ProductVersion
        {
            get
            {
                return "1.0.0.0";
            }
        }

        [DisplayName("Province"), Category("Column")]
        public string Province
        {
            get
            {
                return this.m_Province;
            }
            set
            {
                this.m_Province = value;
            }
        }

        [Category("Column"), DisplayName("Rate")]
        public double Rate
        {
            get
            {
                return this.m_Rate;
            }
            set
            {
                this.m_Rate = value;
            }
        }

        [Category("Column"), DisplayName("Sex")]
        public bool Sex
        {
            get
            {
                return this.m_Sex;
            }
            set
            {
                this.m_Sex = value;
            }
        }

        [DisplayName("SocialInsuranceCode"), Category("Column")]
        public string SocialInsuranceCode
        {
            get
            {
                return this.m_SocialInsuranceCode;
            }
            set
            {
                this.m_SocialInsuranceCode = value;
            }
        }

        [Category("Column"), DisplayName("ToDate")]
        public DateTime ToDate
        {
            get
            {
                return this.m_ToDate;
            }
            set
            {
                this.m_ToDate = value;
            }
        }

        [Category("Column"), DisplayName("Type")]
        public int Type
        {
            get
            {
                return this.m_Type;
            }
            set
            {
                this.m_Type = value;
            }
        }
    }
}

